#include <iostream>

using namespace std;

int main(){

	double a,b,c;
	int k;
	cin >> b >> c;
	k = b / c;
	a = b - c * k;
	cout << a << endl;
	 

    return 0;
}
